<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" lang="zh-CN">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" lang="zh-CN">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" lang="zh-CN">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>虚拟机安装OpenWrt X86（硬盘镜像img文件） | 波波的博客</title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="http://www.freezhongzi.info/wp-content/themes/twentyeleven/style.css" />
<link rel="pingback" href="http://www.freezhongzi.info/xmlrpc.php" />
<!--[if lt IE 9]>
<script src="http://www.freezhongzi.info/wp-content/themes/twentyeleven/js/html5.js" type="text/javascript"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="波波的博客 &raquo; Feed" href="http://www.freezhongzi.info/?feed=rss2" />
<link rel="alternate" type="application/rss+xml" title="波波的博客 &raquo; 评论Feed" href="http://www.freezhongzi.info/?feed=comments-rss2" />
<link rel="alternate" type="application/rss+xml" title="波波的博客 &raquo; 虚拟机安装OpenWrt X86（硬盘镜像img文件）评论Feed" href="http://www.freezhongzi.info/?feed=rss2&#038;p=102" />
<link rel='stylesheet' id='wp-markdown-prettify-css'  href='http://www.freezhongzi.info/wp-content/plugins/wp-markdown/css/prettify.css?ver=1.5.1' type='text/css' media='all' />
<script type='text/javascript' src='http://www.freezhongzi.info/wp-includes/js/comment-reply.min.js?ver=3.8.4'></script>
<script type='text/javascript' src='http://www.freezhongzi.info/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='http://www.freezhongzi.info/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='http://www.freezhongzi.info/wp-content/plugins/wp-markdown/js/prettify.min.js?ver=1.5.1'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.freezhongzi.info/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.freezhongzi.info/wp-includes/wlwmanifest.xml" /> 
<link rel='prev' title='Hash算法的碰撞概率' href='http://www.freezhongzi.info/?p=100' />
<link rel='next' title='OpenWrt网络结构' href='http://www.freezhongzi.info/?p=104' />
<meta name="generator" content="WordPress 3.8.4" />
<link rel='canonical' href='http://www.freezhongzi.info/?p=102' />
<link rel='shortlink' href='http://www.freezhongzi.info/?p=102' />
	<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #e2e2e2; }
</style>
</head>

<body class="single single-post postid-102 single-format-standard custom-background single-author singular two-column right-sidebar">
<div id="page" class="hfeed">
	<header id="branding" role="banner">
			<hgroup>
				<h1 id="site-title"><span><a href="http://www.freezhongzi.info/" rel="home">波波的博客</a></span></h1>
				<h2 id="site-description">Stay hungry, Stay foolish.</h2>
			</hgroup>

						<a href="http://www.freezhongzi.info/">
									<img src="http://www.freezhongzi.info/wp-content/themes/twentyeleven/images/headers/willow.jpg" width="1000" height="288" alt="" />
							</a>
			
								<form method="get" id="searchform" action="http://www.freezhongzi.info/">
		<label for="s" class="assistive-text">搜索</label>
		<input type="text" class="field" name="s" id="s" placeholder="搜索" />
		<input type="submit" class="submit" name="submit" id="searchsubmit" value="搜索" />
	</form>
			
			<nav id="access" role="navigation">
				<h3 class="assistive-text">主菜单</h3>
								<div class="skip-link"><a class="assistive-text" href="#content">跳至主内容区域</a></div>
												<div class="menu"><ul><li ><a href="http://www.freezhongzi.info/">首页</a></li><li class="page_item page-item-141"><a href="http://www.freezhongzi.info/?page_id=141">个人作品</a></li><li class="page_item page-item-123"><a href="http://www.freezhongzi.info/?page_id=123">关于波波</a></li></ul></div>
			</nav><!-- #access -->
	</header><!-- #branding -->


	<div id="main">

		<div id="primary">
			<div id="content" role="main">

				
					<nav id="nav-single">
						<h3 class="assistive-text">文章导航</h3>
						<span class="nav-previous"><a href="http://www.freezhongzi.info/?p=100" rel="prev"><span class="meta-nav">&larr;</span> 上一篇</a></span>
						<span class="nav-next"><a href="http://www.freezhongzi.info/?p=104" rel="next">下一篇 <span class="meta-nav">&rarr;</span></a></span>
					</nav><!-- #nav-single -->

					
<article id="post-102" class="post-102 post type-post status-publish format-standard hentry category-openwrt">
	<header class="entry-header">
		<h1 class="entry-title">虚拟机安装OpenWrt X86（硬盘镜像img文件）</h1>

				<div class="entry-meta">
			<span class="sep">发表于</span><a href="http://www.freezhongzi.info/?p=102" title="17:35" rel="bookmark"><time class="entry-date" datetime="2012-04-19T17:35:17+00:00">2012 年 4 月 19 日</time></a><span class="by-author"><span class="sep">由</span><span class="author vcard"><a class="url fn n" href="http://www.freezhongzi.info/?author=1" title="查看所有由波波发布的文章" rel="author">波波</a></span></span>		</div><!-- .entry-meta -->
			</header><!-- .entry-header -->

	<div class="entry-content">
		<h3>前言</h3>
<p>最近手痒又开始玩OpenWrt，干脆在虚拟机上装了一个。在虚拟机上装OpenWrt有很多方法，官方网站甚至给出了<a href="http://downloads.openwrt.org/backfire/10.03.1-rc4/x86/openwrt-x86-generic-combined-ext2.vmdk">WMware的虚拟机的硬盘文件</a>，我选择原始的硬盘镜像img文件入手，感觉还是很方便的。</p>
<h3>准备</h3>
<ol>
<li>虚拟机
<p>我用的是免费的<a href="https://www.vmware.com/cn/products/desktop_virtualization/player/overview.html">WMware Player</a>，基本够用了，注意要注册后下载。</p>
</li>
<li>Linux发布版LiveCD
<p>这个有很多选择，比如Ubuntu的LiveCD等。我这里用的是比较小巧的基于Ubuntu的<a href="http://puppylinux.org/main/Download%20Latest%20Release.htm">Lucid Puppy</a>，整个LiveCD才100多M。这个主要用作启动盘，方便烧写OpenWrt镜像文件到虚拟机硬盘。</p>
</li>
<li>OpenWrt X86硬盘镜像文件
<p>这个直接从官网上<a href="http://downloads.openwrt.org/backfire/10.03.1-rc4/x86/openwrt-x86-generic-combined-ext2.img.gz">下载</a>，解压后得到img文件就是要安装的硬盘镜像文件。</p>
</li>
<li>一个U盘
<p>这个主要用来给虚拟机拷贝OpenWrt X86的硬盘镜像文件的。</p>
</li>
</ol>
<h3>开始</h3>
<p>首先新建个空的Linux虚拟机，硬盘大小为100M左右（OpenWrt的硬盘镜像才50多M，够用了），注意要保留USB接口。</p>
<p><center><img src="http://www.freezhongzi.info/pic/install_x86_openwrt_WMware1.png" alt="WMware 设置" /></center></p>
<p>在虚拟机CDROM上设置ISO镜像文件为Puppy Linux的iso文件，然后启动虚拟机进入Puppy Linux界面。</p>
<p><center><img src="http://www.freezhongzi.info/pic/install_x86_openwrt_Puppy.png" alt="Puppy Linux" /></center></p>
<p>在Windows上用U盘拷贝OpenWrt X86硬盘镜像文件(openwrt-x86-generic-combined-ext2.img)，然后拔下U盘。</p>
<p>为了能在虚拟机Puppy Linux中识别U盘，接下来要<strong>先点鼠标进入虚拟机里面，再插上U盘</strong>，这样WMware才能检测到是虚拟机需要U盘而不会被外边的Windows抢走U盘:)。</p>
<p>最重要的一步来到了，从U盘把OpenWrt的镜像文件拷贝到系统根目录(root)后，开始真正的安装了。其实安装就一条命令：</p>
<pre><code>dd if=openwrt-x86-generic-combined-ext2.img of=/dev/sda
</code></pre>
<p>用来强大的dd命令直接拷贝镜像文件覆盖硬盘，因为img文件原本对应一个硬盘的镜像嘛。因为OpenWrt本身的硬盘空间只有50多M，空余的硬盘空间也就无所谓了。</p>
<p>最后重启虚拟机，选择从硬盘启动后OpenWrt也就装好了：</p>
<p><center><img src="http://www.freezhongzi.info/pic/install_x86_openwrt_OpenWrt.png" alt="Openwrt" /></center></p>
			</div><!-- .entry-content -->

	<footer class="entry-meta">
		此条目是由<a href="http://www.freezhongzi.info/?author=1">波波</a>发表在<a href="http://www.freezhongzi.info/?cat=6" title="查看OpenWRT中的全部文章" rel="category">OpenWRT</a>分类目录的。将<a href="http://www.freezhongzi.info/?p=102" title="链向虚拟机安装OpenWrt X86（硬盘镜像img文件）的固定链接" rel="bookmark">固定链接</a>加入收藏夹。		
			</footer><!-- .entry-meta -->
</article><!-- #post-102 -->

						<div id="comments">
	
	
			<h2 id="comments-title">
			《<span>虚拟机安装OpenWrt X86（硬盘镜像img文件）</span>》上有4条评论		</h2>

		
		<ol class="commentlist">
				<li class="comment even thread-even depth-1" id="li-comment-235">
		<article id="comment-235" class="comment">
			<footer class="comment-meta">
				<div class="comment-author vcard">
					<img alt='' src='http://0.gravatar.com/avatar/c34540e6a34941a69357b789c9bc487c?s=68&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D68&amp;r=G' class='avatar avatar-68 photo' height='68' width='68' /><span class="fn">3q</span>在<a href="http://www.freezhongzi.info/?p=102#comment-235"><time datetime="2014-04-30T23:26:59+00:00">2014 年 4 月 30 日23:26</time></a><span class="says">说道：</span>
									</div><!-- .comment-author .vcard -->

				
			</footer>

			<div class="comment-content"><p>请问你在那买的虚拟主机。 速度怎么这么快？ 请发个链接。<br />
谢谢</p>
</div>

			<div class="reply">
				<a class='comment-reply-link' href='/?p=102&#038;replytocom=235#respond' onclick='return addComment.moveForm("comment-235", "235", "respond", "102")'>回复 <span>&darr;</span></a>			</div><!-- .reply -->
		</article><!-- #comment-## -->

	<ul class="children">
	<li class="comment byuser comment-author-admin bypostauthor odd alt depth-2" id="li-comment-239">
		<article id="comment-239" class="comment">
			<footer class="comment-meta">
				<div class="comment-author vcard">
					<img alt='' src='http://1.gravatar.com/avatar/112a05f44aa14279aa4f1d90bf71e20a?s=39&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D39&amp;r=G' class='avatar avatar-39 photo' height='39' width='39' /><span class="fn"><a href='http://www.freezhongzi.info' rel='external nofollow' class='url'>波波</a></span>在<a href="http://www.freezhongzi.info/?p=102#comment-239"><time datetime="2014-05-02T22:52:00+00:00">2014 年 5 月 2 日22:52</time></a><span class="says">说道：</span>
									</div><!-- .comment-author .vcard -->

				
			</footer>

			<div class="comment-content"><p>戈戈主机</p>
</div>

			<div class="reply">
				<a class='comment-reply-link' href='/?p=102&#038;replytocom=239#respond' onclick='return addComment.moveForm("comment-239", "239", "respond", "102")'>回复 <span>&darr;</span></a>			</div><!-- .reply -->
		</article><!-- #comment-## -->

	</li><!-- #comment-## -->
</ul><!-- .children -->
</li><!-- #comment-## -->
	<li class="comment even thread-odd thread-alt depth-1" id="li-comment-1522">
		<article id="comment-1522" class="comment">
			<footer class="comment-meta">
				<div class="comment-author vcard">
					<img alt='' src='http://0.gravatar.com/avatar/4508b56d9324605ed69f1deb68b92981?s=68&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D68&amp;r=G' class='avatar avatar-68 photo' height='68' width='68' /><span class="fn">就爱懒蛇</span>在<a href="http://www.freezhongzi.info/?p=102#comment-1522"><time datetime="2014-07-27T14:58:07+00:00">2014 年 7 月 27 日14:58</time></a><span class="says">说道：</span>
									</div><!-- .comment-author .vcard -->

				
			</footer>

			<div class="comment-content"><p>hi，站长，我用dd命令拷贝镜像到/dev/sda，dd执行时间很长，一个小时都没有返回执行结果。请问站长，不同的虚拟机，目标路径是不是不一样？</p>
</div>

			<div class="reply">
				<a class='comment-reply-link' href='/?p=102&#038;replytocom=1522#respond' onclick='return addComment.moveForm("comment-1522", "1522", "respond", "102")'>回复 <span>&darr;</span></a>			</div><!-- .reply -->
		</article><!-- #comment-## -->

	<ul class="children">
	<li class="comment odd alt depth-2" id="li-comment-1568">
		<article id="comment-1568" class="comment">
			<footer class="comment-meta">
				<div class="comment-author vcard">
					<img alt='' src='http://1.gravatar.com/avatar/112a05f44aa14279aa4f1d90bf71e20a?s=39&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D39&amp;r=G' class='avatar avatar-39 photo' height='39' width='39' /><span class="fn"><a href='http://www.freezhongzi.info' rel='external nofollow' class='url'>波波</a></span>在<a href="http://www.freezhongzi.info/?p=102#comment-1568"><time datetime="2014-07-28T15:15:36+00:00">2014 年 7 月 28 日15:15</time></a><span class="says">说道：</span>
									</div><!-- .comment-author .vcard -->

				
			</footer>

			<div class="comment-content"><p>目标是/dev/sda 这个是linux的设备文件都一样的。</p>
</div>

			<div class="reply">
				<a class='comment-reply-link' href='/?p=102&#038;replytocom=1568#respond' onclick='return addComment.moveForm("comment-1568", "1568", "respond", "102")'>回复 <span>&darr;</span></a>			</div><!-- .reply -->
		</article><!-- #comment-## -->

	</li><!-- #comment-## -->
</ul><!-- .children -->
</li><!-- #comment-## -->
		</ol>

		
		
	
									<div id="respond" class="comment-respond">
				<h3 id="reply-title" class="comment-reply-title">发表评论 <small><a rel="nofollow" id="cancel-comment-reply-link" href="/?p=102#respond" style="display:none;">取消回复</a></small></h3>
									<form action="http://www.freezhongzi.info/wp-comments-post.php" method="post" id="commentform" class="comment-form">
																			<p class="comment-notes">电子邮件地址不会被公开。 必填项已用<span class="required">*</span>标注</p>							<p class="comment-form-author"><label for="author">姓名 <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-email"><label for="email">电子邮件 <span class="required">*</span></label> <input id="email" name="email" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-url"><label for="url">站点</label> <input id="url" name="url" type="text" value="" size="30" /></p>
												<p class="comment-form-comment"><label for="comment">评论</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>						<p class="form-allowed-tags">您可以使用这些<abbr title="HyperText Markup Language">HTML</abbr>标签和属性： <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></p>						<p class="form-submit">
							<input name="submit" type="submit" id="submit" value="发表评论" />
							<input type='hidden' name='comment_post_ID' value='102' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
						</p>
						<p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="cd77932191" /></p><script type='text/javascript' src='http://www.freezhongzi.info/wp-content/plugins/akismet/_inc/form.js?ver=3.0.0'></script>
<p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="189"/></p>					</form>
							</div><!-- #respond -->
			
</div><!-- #comments -->

				
			</div><!-- #content -->
		</div><!-- #primary -->


	</div><!-- #main -->

	<footer id="colophon" role="contentinfo">

			

			<div id="site-generator">
								<a href="http://cn.wordpress.org/" title="优雅的个人发布平台">自豪地采用WordPress</a>
			</div>
	</footer><!-- #colophon -->
</div><!-- #page -->

<script type='text/javascript' src='http://www.freezhongzi.info/wp-content/plugins/wp-markdown/js/markdown.min.js?ver=1.5.1'></script>

</body>
</html>